package org.behrang.macbeans.toolbar;

import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.border.Border;

/**
 *
 * @author behrangsa
 */
public class BMToolBarBorder implements Border {

    private static final Insets INSETS = new Insets(0, 0, 1, 0);
    private static final Color COLOR = new Color(64, 64, 64);
    
    public Insets getBorderInsets(Component c) {
        return INSETS;
    }

    public boolean isBorderOpaque() {
        return true;
    }

    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        final Color oldColor = g.getColor();
        
        g.setColor(COLOR);
        final int y0 = y + height - 1;
        final int x1 = x + width;
        g.drawLine(x, y0, x1, y0);
        
        g.setColor(oldColor);
    }
}
